from utils.operators.exchangis_http_sensor import ExchangisHttpSensor
from datetime import timedelta
import json

nowdt='{{ execution_date | cst_ds }}'
nextdt='{{ execution_date | date_add(7) | cst_ds }}'
request_data = {
    "params": [
        {
            "index": "1",
            "sourceMap": {
            },
            "sinkMap": {
                "${param}": nowdt
            }
        }
    ],
    "taskName": [
        {
            "index": "pro_template_yl_lmdm_sys_area_re"
        }
    ]
}


jms_ods__yl_lmdm_sys_area_re = ExchangisHttpSensor(
    task_id="jms_ods__yl_lmdm_sys_area_re",
    endpoint="",
    pre_execute_data=json.dumps(request_data),
    pre_execute_response_check=lambda response: "Submitted succeed" in response.text,
    job_name="pro_template_yl_lmdm_sys_area_re",
    poke_interval=60,
    response_check=lambda response: "Success" in response.text,
    execution_timeout=timedelta(seconds=100 + 120),
    retries=0,
)